package com.sxbbc.common.core.enums;

import com.sxbbc.common.basics.utils.calculation.CalcuUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * banner图位置枚举
 *
 * @author leehao
 * @date 2019-05-14 19:11
 */
public enum BannerPositionEnums {
    HOME(1,"首页",true),
    POINT(2,"积分商城",true),
    GROUP(3,"爆款拼团",true),
    SECKILL(4,"秒杀专区",true);

    private Integer id;
    private String name;
    private boolean show;

    BannerPositionEnums(Integer id, String name, boolean show) {
        this.id = id;
        this.name = name;
        this.show = show;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public boolean isShow() {
        return show;
    }

    public void setShow(boolean show) {
        this.show = show;
    }

    /**
     * 全部
     */
    public static List<BannerPositionEnums> queryAllList() {
        List<BannerPositionEnums> list = new ArrayList<BannerPositionEnums>();
        for (BannerPositionEnums o : BannerPositionEnums.values()) {
            list.add(o);
        }
        return list;
    }

    /**
     * 'show'为true
     */
    public static List<BannerPositionEnums> queryShowList() {
        List<BannerPositionEnums> list = new ArrayList<BannerPositionEnums>();
        for (BannerPositionEnums o : BannerPositionEnums.values()) {
            if (o.isShow()) {
                list.add(o);
            }
        }
        return list;
    }

    public static String getName(Integer id) {
        String str = "";
        for (BannerPositionEnums o : BannerPositionEnums.values()) {
            if (CalcuUtils.getInstance().isEquals(id, o.getId())) {
                str = o.getName();
                break;
            }
        }
        return str;
    }
}
